Test instruments and other electronic devices are controlled using command sets, which include program instructions specific to the instrument. Industry standards have been developed in order to promote efficiency among different types of instruments and different manufacturers. Also, standardization promotes computer control of instruments and systems of instruments interfaced within a control network.
One standard protocol is the Standard Commands for Programmable Instrumentation (SCPI) protocol, which defines a uniform set of commands for controlling programmable test and measurement instruments. A client application, e.g., operating on a remote computer system, may cause instruments with which it interfaces to execute various commands, such as measuring voltages, applying specific signals, performing calibration, and the like. SCPI Commands include “commands” and “queries”. According to the SCPI protocol, a command is an instruction or program message sent to an instrument for controlling settings, measurements, timing and other aspects of the instrument, and a query is an instruction or program message sent to the instrument, to which the instrument responds with a result or response message. In the SCPI protocol, queries contain a “?” symbol and commands do not.
SCPI Commands consist of strings defining certain operations of the instrument, organized in a hierarchical structure referred to as “trees.” For example, the MEASURE command is a parent node of a SCPI Command tree, which configures the instrument to read various types of data or child nodes, identified by the string. For example, the program message “MEASURE:VOLT:DC?” instructs the instrument to measure DC voltage of a received signal and to return the measurement result as a response message. The SCPI protocol also includes a command reference, which provides definitions for the program messages. The command reference definitions specify syntax and semantics of the SCPI program messages, for example.
Programming an instrument in machine-centric form is difficult. For example, in order to program an instrument using SCPI Commands, the user must adequately understand the SCPI protocol and be able convert data types into correctly formatted SCPI strings. For example, if the user wants to retrieve a waveform trace from an instrument using the SCPI protocol, the user must understand SCPI definite length block formatting in order to extract trace data from the response message from the instrument. The user also needs to understand the endianness of the data and the number of bits per data point in order to convert the trace data into an array of trace points that is understandable. The user has no way to know if the strings are formatted correctly until the program is run.
Conventional techniques to simplify programming of instruments introduce an additional interface layer, called a device driver, which attempts to translate a machine-centric interface into human-centric form, and otherwise hide the low-level programming details of sending SCPI Commands to control the instrument. An instrument driver provides a set of instrument control procedures available in an integrated development environment (IDE), such as Visual Studio® and Eclipse®. However, it may be difficult to program instruments using drivers because each driver is different, and may be incomplete and buggy. However, instrument drivers do save time over direct programming using SCPI Commands, since instrument drivers catch errors at compile time rather than run time.